import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;


public class ASINReviews {
private String ASIN;
private int stars;
private String title;
private Date reviewDat;
private String author;
private String location;
private String reviewText;
private String helpful;
public String getASIN() {
	return ASIN;
}
public void setASIN(String aSIN) {
	ASIN = aSIN;
}
public int getStars() {
	return stars;
}
public void setStars(int stars) {
	this.stars = stars;
}
public String getTitle() {
	return title;
}
public void setTitle(String title) {
	this.title = title;
}
public Date getReviewDat() {
	return reviewDat;
}
public void setReviewDat(Date reviewDat) {
	this.reviewDat = reviewDat;
}
public String getAuthor() {
	return author;
}
public void setAuthor(String author) {
	this.author = author;
}
public String getLocation() {
	return location;
}
public void setLocation(String location) {
	this.location = location;
}
public String getReviewText() {
	return reviewText;
}
public void setReviewText(String reviewText) {
	this.reviewText = reviewText;
}
public String getHelpful() {
	return helpful;
}
public void setHelpful(String helpful) {
	this.helpful = helpful;
}

public static void insert(Connection connection,List<ASINReviews> list){
	if(list.size()<1) return;

	try {
		PreparedStatement ps = connection
				.prepareStatement("insert into ASINReviews(ASIN,stars,title,reviewDat,author,location,reviewText,helpful) values(?,?,?,?,?,?,?,?)");
		for (ASINReviews dt : list) {
			ps.setString(1, dt.getASIN());
			
			ps.setInt(2, dt.getStars());
			ps.setString(3, dt.getTitle());
			ps.setDate(4, new java.sql.Date( dt.getReviewDat().getTime()));
			ps.setString(5, dt.getAuthor());
			ps.setString(6, dt.getLocation());
			ps.setString(7, dt.getReviewText());
			ps.setString(8, dt.getHelpful());

			ps.addBatch();
		}
	ps.executeBatch();
		connection.commit();
			} catch (SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	
}

}
